
package com.android.finaltracer.util;

import android.content.Context;
import android.content.SharedPreferences;

public class StateSharedPreferences {
    public static final String STATE = "state";
    public static final String IS_FIRST_RUN_APP = "is_first_run_app";
    public static final String HAS_SHOW_HELP = "has_show_help";
    private Context mContext;
    private static StateSharedPreferences mStateSharedPreferencesUtil;

    private StateSharedPreferences(Context mContext) {
        super();
        this.mContext = mContext;
    }

    public static StateSharedPreferences getInstance(Context mContext) {
        if (mStateSharedPreferencesUtil == null) {
            mStateSharedPreferencesUtil = new StateSharedPreferences(
                    mContext);
        }
        return mStateSharedPreferencesUtil;
    }

    public boolean getFirstRunState() {
        SharedPreferences sp = mContext.getSharedPreferences(STATE,
                Context.MODE_PRIVATE);
        return sp.getBoolean(IS_FIRST_RUN_APP, true);
    }

    public void setFirstRunState(boolean firstRun) {
        SharedPreferences sp = mContext.getSharedPreferences(STATE,
                Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sp.edit();
        editor.putBoolean(IS_FIRST_RUN_APP, firstRun).commit();
    }

    // public boolean getHasShowHelp() {
    // SharedPreferences sp = mContext.getSharedPreferences(STATE,
    // Context.MODE_PRIVATE);
    // return sp.getBoolean(HAS_SHOW_HELP, false);
    // }
    //
    // public void setHasShowHelp(boolean hasShowHelp) {
    // SharedPreferences sp = mContext.getSharedPreferences(STATE,
    // Context.MODE_PRIVATE);
    // SharedPreferences.Editor editor = sp.edit();
    // editor.putBoolean(HAS_SHOW_HELP, hasShowHelp).commit();
    // }
}
